package com.servlet.service;

import java.util.List;

import com.servlet.dao.UserDao;
import com.servlet.dao.impl.UserDaoImpl;
import com.servlet.entity.User;

public class UserService {
	/**
	 * 查询
	 * @return
	 */
	public List<User> getListAll(){
		UserDao userDao = new UserDaoImpl();
		List<User> list = userDao.getListAll();
		return list;
	}
	/**
	 * 保存
	 * @param user
	 */
	public int save(User user) {
		UserDao userDao=new UserDaoImpl();
		int count = userDao.saveUser(user);
		return count;
	}
	/**
	 * 删除
	 * @param id
	 */
	public int deleteUser(Integer id) {
		UserDao userDao=new UserDaoImpl();
		return userDao.deleteUser(id);
	}
	/**
	 * 根据id查询
	 */
	public User getFindById(Integer id){
		UserDao userDao=new UserDaoImpl();
		return userDao.getById(id);
	}
	/**
	 * 修改
	 */
	public int update(User user) {
		UserDao userDao=new UserDaoImpl();
		return userDao.updateUser(user);
	}
}
